package com.localShare.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.localShare.Constant;

/**
 * Created by 883564
 * on 2016/4/22.
 * 屏幕点亮，广播接收器
 */
public class ScreenOnReceiver extends BroadcastReceiver {
    /**
     * 接收器接收到广播后的处理方法
     * @param context 上下文
     * @param intent 意图
     */
    @Override
    public void onReceive(Context context, Intent intent) {
        //使用隐式意图启动主Activity
        Intent intent1 =new Intent(Constant.SCREEN_ON_RECEIVER_ACTION);
        //设置意图标识为新栈
        intent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        //启动Activity
        context.startActivity(intent1);
    }
}
